Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HH-212492 use fastapi server/routing #695

Closed
wants to merge 1 commit into from
Closed

HH-212492 use fastapi server/routing #695

wants to merge 1 commit into from

Conversation

712u3
Copy link
Contributor

@712u3 712u3 commented Apr 4, 2024

@712u3 712u3 requested a review from a team as a code owner April 4, 2024 12:41
frontik/app.py Outdated Show resolved Hide resolved
frontik/app.py Outdated
return chunk


async def core_middle_ware(request: Request, call_next):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

middelware в одно слово

@712u3 712u3 force-pushed the HH-212492 branch 3 times, most recently from 7696346 to cb651ff Compare April 5, 2024 06:05
return super().get(path, **kwargs)

def post(self, path: str, **kwargs) -> Callable:
self._cls, self._path = kwargs.pop('cls'), path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему тогда cls не сделать параметром?

page_module_name = '.'.join(filter(None, (self.name, page_name)))
routing_logger.debug('page module: %s', page_module_name)
def build_path() -> str:
curframe = inspect.currentframe()
Copy link
Contributor

@bokshitsky bokshitsky Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не могу найти, где build_path вызывается?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это в сервисах будет

@router.get(build_path(), cls=PageHandler, dependencies=[d1,d2])
async def my_mega_page(self=get_current_handler):
    ...

Copy link
Contributor

@bokshitsky bokshitsky Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

там нельзя как-то __file__ передать или типа того?
жесть же по стектрейсу выбирать

http_server.start()

fill_router(frontik_app.app_module)
_fastapi_app.frontik_app = frontik_app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_fastapi_app в глобальном скоупе как будто проблем только создаст, нельзя его лоальным сделать?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно 👍🏻
из какого-то чернового варианта осталось(

modify_times: dict[str, float] = {}
reload = partial(tornado.autoreload._reload_on_update, modify_times)

server_task = asyncio.gather(server._serve(), periodic_task(reload, check_time))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в ювикорне, вроде авторелоад параметрами передать можно?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно потом еще потыкаться, но мне показалось что он ужасен и не подходит нам

во первых он тогда обязательно должен быть не в синглпроцессе а в супервайз режиме и это ломает способ запуска (всмысле вот эти все функции сервер старт/рег в консуле) и сигнал хендлинг при выключении
хз нормально ли оно вообще с нашими докерами/куберами будет работать, типа у нас станет основной процесс супервайзер
во вторых он трекает только фронтик и надо упороться чтобы заставить его другие пакеты тоже мониторить

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а торнадовский прост и идеален
смотрит каждые 0,5с на все что у нас заимпорчено, если есть изменения реимпортит

@712u3 712u3 force-pushed the HH-212492 branch 19 times, most recently from 01b3784 to 0b43ede Compare April 10, 2024 15:25
@712u3 712u3 force-pushed the HH-212492 branch 10 times, most recently from d23a77d to d26af5f Compare April 17, 2024 03:21
@712u3 712u3 force-pushed the HH-212492 branch 7 times, most recently from db3467b to 272926b Compare April 21, 2024 06:16
Copy link

hh-sonar bot commented Apr 25, 2024

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@712u3 712u3 closed this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants